<?php
$operations = Blyn::app()->getActiveApp()->getOperations(array('user' => Blyn::app()->getCurrentUser()));

$items = array();

foreach ($operations as $id => $opp) {
    //if (Blyn::app()->getActiveApp()->getId() != Blyn::app()->getCurrentUser()->getPersonalSpace()->getAppByName('BPersonalApp')->getId()) {
        $item = array();
        $menuStr = Yii::t('site', $opp->getName(BEntity::Name_DisplayName));
        //$item['url'] = $opp->getUIManager()->getUrl(array('ajaxLink' => array('name' => $opp->getDisplayName())));
        if ($opp->getName() != 'bookingFacility')
            $item['url'] = $opp->getUIManager()->getAjaxLink($menuStr);
        else
        // $item['url'] = $opp->getUIManager()->getLink($menuStr, null, 'stadium/index', array('device' => 'weixin'));
            $item['url'] = $opp->getUIManager()->getAjaxLink($menuStr);
        $item['label'] = $menuStr;
//        $item['label'] = $opp->getName(BEntity::Name_DisplayName);
        $item['active'] = '';
        //$item['active'] = FALSE;

        $activeOperation = Blyn::app()->getActiveOperation();

        if ($activeOperation instanceof BOperation && $opp->getId() == $activeOperation->getId())
            $item['active'] = 'active';
        // $item['active'] = TRUE;

        array_push($items, $item);
   // }
}
?>
<div class="container" style="margin: auto;padding-top: 15px">
    <ul class="nav nav-pills">
        <?php foreach ($items as $item) { ?>
            <li class=<?php echo $item['active']; ?>>
                <?php echo $item['url']; ?>
            </li>  
        <?php } ?>
    </ul>
</div>


